#include "MouseElement.h"

namespace OpenNano
{
    REGISTER_OBJECT_FACTORY( MouseElement, MOUSE_TAG );

    MouseElement::MouseElement(TiXmlElement *element):
                    ConfigElement(element), logger(log4cplus::Logger::getInstance( MOUSE_TAG )), _interpreter()
            {
            }

    MouseElement::~MouseElement()
    {
    }

    void MouseElement::init()
    {
        LOG4CPLUS_INFO(logger, "Mouse element: initialized");
    }

    const std::string& MouseElement::getInterpreter() const
    {
        return _interpreter;
    }

   void MouseElement::attributeFound(TiXmlAttribute * attribute)
    {
        if ( attribute->NameTStr().compare(MOUSE_INTERPRETER_ATTRIBUTE) == 0 )
        {
            _interpreter=attribute->ValueStr();
        }
        else
        {
            //attribute not recognized
            LOG4CPLUS_WARN(logger, "Attribute not recognized:");
            LOG4CPLUS_WARN(logger, attribute->NameTStr());

            unknownAttributeFound(attribute);
        }
    }

    void MouseElement::childElementFound(TiXmlElement * childElement)
    {
        //Element not recognized
        LOG4CPLUS_WARN(logger, "Child element not recognized:");
        LOG4CPLUS_WARN(logger, childElement->ValueStr());

        unknownElementFound(childElement);
    }

    void MouseElement::textFound(const char* text)
    {
        LOG4CPLUS_WARN(logger, "Text not recognized:");
        LOG4CPLUS_WARN(logger, text);

        unknownTextFound(text);
    }

    bool MouseElement::postConfiguration()
    {
        return !_interpreter.empty();
    }



}
